//
//  VideoViewController.m
//  AIM
//
//  Created by user10 on 2017/6/8.
//  Copyright © 2017年 user10. All rights reserved.
//

#import "VideoViewController.h"
#import <AVKit/AVKit.h>
#import <AVFoundation/AVFoundation.h>

@interface VideoViewController ()

@end

@implementation VideoViewController{
    AVPlayerViewController * avPlayer;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor blackColor];
    
    NSURL * videoURL = [NSURL URLWithString:_url];
    avPlayer = [[AVPlayerViewController alloc] init];
    avPlayer.player = [[AVPlayer alloc] initWithURL:videoURL];
    /*
     可以设置的值及意义如下：
     AVLayerVideoGravityResizeAspect   不进行比例缩放 以宽高中长的一边充满为基准
     AVLayerVideoGravityResizeAspectFill 不进行比例缩放 以宽高中短的一边充满为基准
     AVLayerVideoGravityResize     进行缩放充满屏幕
     */
    avPlayer.videoGravity = AVLayerVideoGravityResizeAspect;
    
    [self presentViewController:avPlayer animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
